
//
//  ShopDetailTopImgTableViewCell.m
//  GoShops
//
//  Created by zcj on 15-12-1.
//  Copyright (c) 2015年 郑朝军. All rights reserved.
//

#import "ShopDetailTopImgTableViewCell.h"
#import "Grouble.h"

@interface ShopDetailTopImgTableViewCell()
@property (nonatomic,weak)UIImageView *topImageView;
@property (nonatomic,weak)UIImageView *topImage;
@property (nonatomic,weak)UILabel * myLable;
@property (nonatomic,weak)UIImageView *topLeftView;

@end
@implementation ShopDetailTopImgTableViewCell

+ (instancetype)ShopDetailTopImgTableViewCell:(UITableView *)tableView
{
    static NSString *menuID = @"shopdetailtopimg";
    ShopDetailTopImgTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:menuID];
    if (cell == nil) {
        cell = [[ShopDetailTopImgTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:menuID];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;

}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        UIImage * myImg = [UIImage imageNamed:@"icon_homepage_map"];
      
        UIImageView * topImageView = [[UIImageView alloc]initWithImage:myImg];
        topImageView.contentMode  = UIControlContentHorizontalAlignmentLeft;
        [self addSubview:topImageView];
        self.topImageView = topImageView;
        NSString * str = @"郑朝军";

        CGSize myLableWH = [str sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20]}];
        
        UILabel * myLable = [[UILabel alloc]initWithFrame:CGRectMake(35, 128,myLableWH.width, myLableWH.height)];
        myLable.numberOfLines = 0;
        myLable.text = str;
        myLable.font = [UIFont systemFontOfSize:14];
        myLable.textAlignment = NSTextAlignmentCenter;
        
        [self addSubview:myLable];
        self.myLable = myLable;
        
        //self.imageView.contentMode = UIControlContentHorizontalAlignmentLeft;
        
        self.imageView.image = [UIImage imageNamed:@"faxingtwo"];
        
        // 右边的view
        UIImage * LeftMyImg = [UIImage imageNamed:@"icon_deal_phone"];
        
        UIImageView * LeftImageView = [[UIImageView alloc]initWithImage:LeftMyImg];
        [self addSubview:LeftImageView];
        self.topLeftView = LeftImageView;
        
    }
    return self;
}

- (void)awakeFromNib
{
    // Initialization code
}
- (void)layoutSubviews
{
    [super layoutSubviews];

    self.imageView.frame = CGRectMake(0, 0, ScreenWidth, 120);
    
    self.topImageView.frame = CGRectMake(0, 125, 50, 35);
   
    CGFloat leftViewX = ScreenWidth - 40;
    
    self.topLeftView.frame = CGRectMake(leftViewX, 125, 40, 35);
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
